﻿using System.Windows.Forms;

partial class MySqlConnectionStringEditor : UserControl
{
    public MySqlConnectionStringEditor()
    {
        InitializeComponent();
    }

    public MySqlConnectionStringEditor(string connectionString)
    {
        InitializeComponent();

        MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectionString);

        tbServer.Text = builder.Server;
        tbDatabase.Text = builder.Database;
        tbUid.Text = builder.Uid;
        tbPwd.Text = builder.Pwd;
    }

    public override string ToString()
    {
        // http://www.connectionstrings.com/mysql
        return string.Format("Server={0};Database={1};Uid={2};Pwd={3};",
            tbServer.Text,
            tbDatabase.Text,
            tbUid.Text,
            tbPwd.Text);
    }
}
